using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(ActionDistance))]
[RequireComponent(typeof(ActiveObject))]
public class Object : MonoBehaviour
{
    [SerializeField] private Item data;

    private ActionDistance actionDistance;
    private void Start()
    {
        actionDistance = GetComponent<ActionDistance>();
        actionDistance.s = false;
    }

    private void OnMouseDown()
    {
        if (actionDistance.s)
        {
            PlayerData.AddItemInInventory(new Item(data.name, data.imgUrl, data.count));
            gameObject.GetComponent<ActiveObject>().IsDisactive();
        }
    }
}
